<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<div id="main_quesquesList" class="easyui-layout" fit="true">
    <div region="center" style="padding: 1px;">
        <t:datagrid name="quesquesList" title="" actionUrl="quesquesController.do?datagrid&qsId=${qsId}" idField="id" fit="true"
                    queryMode="group" onLoadSuccess="loadSuccess" pagination="false">
            <t:dgCol title="主键" field="id" width="1"></t:dgCol>
            <t:dgCol title="题号" field="quesNo" width="1"></t:dgCol>
            <t:dgCol title="名称" field="name" query="true" width="5"></t:dgCol>
            <t:dgCol title="类型" field="quesType" dictionary="questType" query="true" width="1"></t:dgCol>
            <t:dgCol title="有效" field="effective" dictionary="isno" width="1"></t:dgCol>

            <t:dgCol title="common.operation" field="opt" width="3"></t:dgCol>
            <t:dgDelOpt url="quesquesController.do?del&id={id}" title="删除"></t:dgDelOpt>
            <t:dgConfOpt exp="effective#eq#1" url="quesquesController.do?stop_or_start&id={id}" title="禁用" message="是否禁用此问题？"></t:dgConfOpt>
            <t:dgConfOpt exp="effective#eq#0" url="quesquesController.do?stop_or_start&id={id}" title="启用" message="是否启用此问题？"></t:dgConfOpt>
            <t:dgFunOpt funname="showxx(id,name)" title="选项"></t:dgFunOpt>

            <t:dgToolBar title="新增" icon="icon-add" url="quesquesController.do?addorupdate&qsId=${qsId}" funname="add" width="600"
                         height="550"></t:dgToolBar>
            <t:dgToolBar title="修改" icon="icon-edit" url="quesquesController.do?addorupdate&qsId=${qsId}" funname="f_updateInfo"
                         width="600" height="550"></t:dgToolBar>
            <%--<t:dgToolBar title="详情" icon="icon-search" url="quesquesController.do?addorupdate&qsId=${qsId}" funname="f_detail"  width="600" height="550"></t:dgToolBar>--%>

        </t:datagrid>
    </div>
</div>
<div data-options="region:'east',
	title:'选项',
	collapsed:true,
	split:true,
	border:false,
	onExpand : function(){
		li_east = 1;
	},
	onCollapse : function() {
	    li_east = 0;
	}"
     style="width: 400px; overflow: hidden;" id="eastPanel">
    <div class="easyui-panel" style="padding: 1px;" fit="true" border="false" id="showPanel2"></div>
</div>
<script type="text/javascript">
    $(function () {
        var li_east = 0;
    });
    function f_updateInfo(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择编辑问题');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条问题再编辑');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }


function showxx(id,name) {
    var title = name;
    if (li_east == 0) {
        $('#main_quesquesList').layout('expand', 'east');
    }
    $('#main_quesquesList').layout('panel', 'east').panel('setTitle', title);
    $('#main_quesquesList').layout('panel', 'east').panel('resize', {width: 400});
    $('#showPanel2').panel("refresh", "qqOptionController.do?index&id=" + id);
}

</script>
